import { useState, forwardRef, useImperativeHandle } from 'react';
function Child(props, ref) {
  useImperativeHandle(ref, () => ({ message: 'hell' + Math.random() }));
  console.log('---- render child');
  const [v, setV] = useState(0);
  return (
    <div style={{ border: '1px solid #edf' }}>
      this is child <button onClick={() => setV((p) => p + 1)}>+1</button>
      {v}
    </div>
  );
}
export default forwardRef(Child);
